package com.victor.bookretail.service.point;

import com.victor.bookretail.domain.PointCalculateParameter;
import com.victor.bookretail.domain.UserTypeEnum;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.stereotype.Component;

@Component
public class GoldUserCalculation implements PointCalculation, InitializingBean {

    @Override
    public int calculate(PointCalculateParameter calculateParameter) {
        return calculateParameter.getAmount() * 3;
    }

    @Override
    public void afterPropertiesSet() throws Exception {
        PointCalculationManager.registerPointCalculation(UserTypeEnum.GOLD.getCode(), this);
    }

}
